package videoExercises;

import java.util.ArrayList;

public class TestStream {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("小米-5");
        list.add("王敏-19");
        list.add("李小建-18");
        list.add("王小明-18");
        /*list.stream().map(new Function<String, Integer>() {
            @Override
            public Integer apply(String s){
                String[] split = s.split("-");
                String s1 = split[1];
                int i = Integer.parseInt(s1);
                return i;
            }
        }).forEach(n->System.out.println (n));*/

        list.stream().map(s->{
                String[] split = s.split("-");
                String s1 = split[1];
                int i = Integer.parseInt(s1);
                return i;
            }
        ).forEach(n->System.out.println (n));

    }
}
